<style type="text/css">
	.revoke-warp{position: fixed;z-index: 99;display: block;width: 100%;top: 0;left: 0;bottom: 0;right: 0;}
</style>
<template>
	<div class="container" v-title data-title='楼盘详情'>
		<div class="premises-details">
			<div class="premises-img"  @click="toPremisesDetail(item.id)">
                <a v-if="premises.panoramicView" :href="premises.panoramicView" target="_blank">
                <img v-if="premises.panoramicView" class="panorama360"  src="./../../assets/images/panorama360.png">
				</a>
				<img :src="premises.url">
				<a href="javascript:;" class="sale">{{saleStatus}}</a>
				<span class="main-push-left" v-if="premises.mainPush==2">主推楼盘</span>
			</div>
			<div class="premises-mask-info">
				<div class="col-sm-6 name">{{premises.name}}</div>
				<div class="col-sm-6 square"><span class="premises-color"><b>{{premises.averagePrice}}&nbsp;元/平米</b></span></div>
			</div>
			<div v-if="premises.codeNameCN" class="codeNameContainer">
				<div v-for="(item,key) in premises.codeNameCN.split(',')" :key="key" class="codeNameItem">{{item}}</div>
			</div>
			<div class="premise-address">
				<div class="col-sm-12">区域：<span class="text">{{premises.area.name}}</span></div>
				<div class="col-sm-12">地址：<span class="text">{{premises.premisesAddress}}</span></div>
			</div>
		</div>

		<div class="bor-b" v-isShow></div>
		
		<div class="line bor-b"></div>

		<mt-navbar v-model="selected">
			<mt-tab-item id="1">楼盘首页</mt-tab-item>
			<mt-tab-item id="2"><span @click="initLoading">楼盘详情</span></mt-tab-item>
			<mt-tab-item id="3">可售户型</mt-tab-item>
			<mt-tab-item id="4">楼盘相册</mt-tab-item>
		</mt-navbar>    
		<div class="bor-b" v-isShow></div>
		<mt-tab-container v-model="selected">
			<mt-tab-container-item id="1">
				<!-- 楼盘动态 -->
				<!-- <div class="premisesInfo" v-if="premisesDynamic">
					<div class="title">
						<span class="left">楼盘动态</span>
						<span class="right" @click="goPremisesDynamicList">更多动态 ></span>
					</div>
					<div class="dynamicInfo" @click="toDetail(premisesDynamic.id)">
						<h1 v-html="premisesDynamic.title"></h1>
						<img v-if="premisesDynamic.imgUrl" :src="premisesDynamic.imgUrl" />
						<span v-if="premisesDynamic.content" v-html="premisesDynamic.content"></span>
					</div>
				</div> -->
				<!-- 在售户型 -->
				<div class="premisesInfo">
					<div class="title">
						<span class="left">在售户型（{{someList.length}}）</span>
						<span class="right" @click="moreInfo('3')">更多户型 ></span>
					</div>
					<div class="sellImg">
						<img :src="someList[0].urls[0]" @click="moreInfo('3')"/>
					</div>
					<div class="bottomInfo">
						{{someList[0].title}}&nbsp;&nbsp;{{someList[0].area}}㎡
					</div>
				</div>
				<!-- 楼盘详情 -->
				<div class="premisesInfo" style="padding-bottom: 30px;">
					<div class="title">
						<span class="left">楼盘详情</span>
						<span class="right" @click="moreInfo('2')">更多详情 ></span>
					</div>
					<ul class="item-title-half">
						<div class="exhibition-title2 logo-pos02"><span class="title-logo2"></span>楼盘信息</div>
						<li>
							<div class="title">开发商</div>
							<div class="itemText">{{premises.buildingCompany}}</div>
						</li>
						<li>
							<div class="title">建筑类别</div>
							<div class="itemText">{{premises.buildingTypeCN}}</div>
						</li>
						<li v-show="premises.averagePrice" v-isShow>
							<div class="title">楼盘均价</div>
							<div class="itemText">{{premises.averagePrice}}元/㎡</div>
						</li>
						<li>
							<div class="title">装修状况</div>
							<div class="itemText">{{premises.decorationTypeName}}</div>
						</li>
						<li>
							<div class="title">规划户数</div>
							<div class="itemText">{{premises.houseHolds}}</div>
						</li>
					</ul>
				</div>
				<!-- 楼盘相册 -->
				<div class="premisesInfo" v-if="premisesImageShow && premisesImageShow.length > 0">
					<div class="title">
						<span class="left">楼盘相册</span>
						<span class="right" @click="moreInfo('4')">更多图片 ></span>
					</div>
					<div class="sellImg">
						<img :src="premisesImageShow[0].imgUrl" @click="moreInfo('4')"/>
					</div>
					<div style="height: 36px;line-height: 36px;text-align:center;font-size: 15px;">
						{{premisesImageShow[0].title}}
					</div>
				</div>
			</mt-tab-container-item>
			<mt-tab-container-item id="2">
				<!-- 楼盘信息 -->
				<ul class="item-title-half">
					<div class="exhibition-title2 logo-pos02"><span class="title-logo2"></span>楼盘信息</div>
					<li>
						<div class="title">开发商</div>
						<div class="itemText">{{premises.buildingCompany}}</div>
					</li>
					<li>
						<div class="title">建筑类别</div>
						<div class="itemText">{{premises.buildingTypeCN}}</div>
					</li>
					<li v-show="premises.averagePrice" v-isShow>
						<div class="title">楼盘均价</div>
						<div class="itemText">{{premises.averagePrice}}元/㎡</div>
					</li>
					<li>
						<div class="title">装修状况</div>
						<div class="itemText">{{premises.decorationTypeName}}</div>
					</li>
					<li>
						<div class="title">规划户数</div>
						<div class="itemText">{{premises.houseHolds}}</div>
					</li>
					<li>
						<div class="title">产权年限</div>
						<div class="itemText" v-if="premises.rightYears != ''">{{premises.rightYears}}年</div>
					</li>
					<li>
						<div class="title">容积率</div>
						<div class="itemText" v-if="premises.plotRatio">{{premises.plotRatio}}%</div>
					</li>
					<li>
						<div class="title">绿化率</div>
						<div class="itemText" v-if="premises.greeningRate != ''">{{premises.greeningRate}}%</div>
					</li>
					<li>
						<div class="title">物业类型</div>
						<div class="itemText">{{premises.estateTypeCN}}</div>
					</li>
					<li>
						<div class="title">物业公司</div>
						<div class="itemText">{{premises.propertyCompany}}</div>
					</li>
					<li>
						<div class="title">物业地址</div>
						<div class="itemText">{{premises.propertyAddr}}</div>
					</li>
					<li v-show="premises.propertyCharges" v-isShow>
						<div class="title">物业费用</div>
						<div class="itemText">{{premises.propertyCharges}}元/㎡/月</div>
					</li>
					<li>
						<div class="title">地上车位数</div>
						<div class="itemText">{{premises.upCarPort}}</div>
					</li>
					<li>
						<div class="title">地下车位数</div>
						<div class="itemText">{{premises.downCarPort}}</div>
					</li>
				</ul>
				<div class="line bor-b" v-isShow></div>
				<ul class="item-title-half">
					<div class="exhibition-title2 logo-pos02"><span class="title-logo2"></span>销售信息</div>
					<li>
						<div class="title">楼盘地址</div>
						<div class="itemText">{{premises.premisesAddress}}</div>
					</li>
					<li>
						<div class="title">售楼部地址</div>
						<div class="itemText">{{premises.saleAddr}}</div>
					</li>
					<li v-show="premises.formatCheckInTime" v-isShow>
						<div class="title">开盘时间</div>
						<div class="itemText">{{premises.formatOpeningTime}}</div>
					</li>
					<li v-show="premises.formatCheckInTime" v-isShow>
						<div class="title">入住时间</div>
						<div class="itemText">{{premises.formatCheckInTime}}</div>
					</li>
				</ul>

				<div class="line bor-b" v-show="qdltqyShowFlag&&premises.feature"></div>
				<ul class="ul-list-view" v-show="qdltqyShowFlag&&premises.feature">
					<li class="ul-list-view-cell pT14 pB14">
						<a href="javascript:;">
							<div class="exhibition-title logo-pos04"><span class="title-logo"></span>项目特色</div>
						</a>
					</li> 
					<li class="ul-list-view-cell">
						<div class="rule-text">
							<p class="rule-textAll" v-html="premises.feature"></p>
						</div>
						<div class="open-info-btn" v-show="flagA" @click = "openDiv(0)">
							<a href="javascript:;" class="openBtn">{{flagAName}}<i class="fa fa-caret-right"></i></a>
							<span class="line-dash"></span>
						</div>
					</li>
				</ul>

				<div class="line bor-b" v-isShow v-show="premises.discount"></div>
				<ul class="ul-list-view" v-isShow v-show="premises.discount">
					<li class="ul-list-view-cell pT14 pB14" >
						<a href="javascript:;">
							<div class="exhibition-title logo-pos04"><span class="title-logo"></span>促销信息</div>
						</a>
					</li> 
					<li class="ul-list-view-cell">
						<div class="rule-text">
							<p class="rule-textAll" v-html="premises.discount"></p>
						</div>
						<div class="open-info-btn" v-show="flagB" @click = "openDiv(1)">
							<a href="javascript:;" class="openBtn">{{flagBName}}<i class="fa fa-caret-right"></i></a>
							<span class="line-dash"></span>
						</div>
					</li>
				</ul>
		
					<div class="line bor-b" v-show="premises.selling"></div>
					<ul class="ul-list-view" v-show="premises.selling">
						<li class="ul-list-view-cell pT14 pB14">
							<a href="javascript:;">
								<div class="exhibition-title logo-pos04"><span class="title-logo"></span>楼盘卖点</div>
							</a>
						</li> 
						<li class="ul-list-view-cell">
							<div class="rule-text" style="clear:both">
								<p class="rule-textAll" v-html="premises.selling"></p>
							</div>
							<div class="open-info-btn" v-show="flagD" @click = "openDiv(3)">
								<a href="javascript:;" class="openBtn">{{flagDName}}<i class="fa fa-caret-right"></i></a>
								<span class="line-dash"></span>
							</div>
						</li>
					</ul>
					<div class="line bor-b" v-show="premises.introduction"></div>
					<ul class="ul-list-view"  v-show="premises.introduction">
						<li class="ul-list-view-cell pT14 pB14">
							<a href="javascript:;">
								<div class="exhibition-title logo-pos04"><span class="title-logo"></span>项目简介</div>
							</a>
						</li> 
						<li class="ul-list-view-cell">
							<div class="rule-text" style="clear:both">
								<p class="rule-textAll" v-html="premises.introduction"></p>
							</div>
							<div class="open-info-btn" v-show="flagG" @click = "openDiv(6)">
								<a href="javascript:;" class="openBtn">{{flagGName}}<i class="fa fa-caret-right"></i></a>
								<span class="line-dash"></span>
							</div>
						</li>
					</ul>
					<!-- <div class="line bor-b" v-isShow v-show="preDynamicList.length>0"></div>
					<ul class="ul-list-view list-view-icon-right" v-isShow v-show="preDynamicList.length>0">
						<li class="ul-list-view-cell pT14 pB14" >
							<a href="javascript:;">
								<div class="exhibition-title logo-pos03"><span class="title-logo"></span>最近活动</div>
							</a>
						</li>
						<li class="ul-list-view-cell pT14 pB14" v-for="(row, index) in preDynamicList" :key="index">
							<a href="javascript:;" class="list-navigate-right" v-on:click="toDetail(row.id)">
								<div class="col-sm-9">{{row.title}}</div>
								<div class="col-sm-3 taR f12 col-tTwo">{{row.createTime}}</div>
							</a>
						</li>
					</ul> -->
					
			</mt-tab-container-item>
			<mt-tab-container-item id="3" style="background-color: #FFF;">
				<ul class="ul-list-view list-view-icon-right">
					<li class="ul-list-view-cell pT14 pB14" v-for="(row, index) in someList" :key="index">
						<div class="houseTypeItem"  v-on:click="pageFun(index)">
							<img :src="row.urls[0]" class="sellHouseImg"/>
                            <div class="hxtImgTip">{{row.urls.length}}张</div>
							<div class="sellHouseInfo">
								<div>{{row.title}}</div>
								<div>{{row.area}}㎡</div>
							</div>
						</div>
					</li>
				</ul>
			</mt-tab-container-item>
			<mt-tab-container-item id="4">
				<div class="premisesAlbum" v-for="(row, index) in premisesImageShow" :key="index">
					<img :src="row.imgUrl" v-on:click="premisesImageClick(row.key)">
					<div class="text">{{row.title}}</div>
				</div>
			</mt-tab-container-item>
		</mt-tab-container>


		<!-- 图片浏览 -->
		<swiper :options="swiperOption" class="swiper-box" v-show="swiperShow">
			<swiper-slide class="swiper-item" v-for="(s,key) in swiperList" :key="key">
				<div class="swiper-title">{{s.title}}</div>
				<div><img v-bind:src="s.url" :style="{height:height+'px',maxWidth:width+'px'}"/></div>
			</swiper-slide>
			<div class="prev" slot="button-prev"></div>
			<div class="next" slot="button-next"></div>
			<div class="swiper-pagination" slot="pagination"></div>
		</swiper>

		<div class="swiper-closed"  v-show="swiperShow || piShow">
			<mt-button type="danger" icon="back" @click="swiperShow=false;piShow=false"></mt-button>
		</div>
		<!-- 图片浏览 -->

		<!-- 楼盘相册-->
		<swiper :options="swiperOption" class="swiper-box" v-show="piShow">
			<swiper-slide class="swiper-item" v-for="(s,index) in premisesImagesSubList" :key="index">
				<div class="swiper-title">{{index+1}}/{{premisesImagesSubList.length}}</div>
				<div><img v-bind:src="s.imageUrl" style="height: 300px" :style="{height:'300px',maxWidth:width+'px'}"/></div>
			</swiper-slide>
			<div class="prev" slot="button-prev"></div>
			<div class="next" slot="button-next"></div>
			<div class="swiper-pagination" slot="pagination"></div>
		</swiper>
		<!-- 楼盘相册-->

		<div class="revoke-warp animated"  v-if="show" :class={bounceIn:show}>
        	<slider :pages="someList" :sliderinit="sliderinit"  v-on:revoke-layer='revokeTo'></slider>
        </div>

		<!-- 分享 案场热线 推荐客户 -->
		<div class="share">
			<div class="col-sm-3 share-left">
				<button class="share-a" @click="shareImg=true"><i class="fa fa-share" aria-hidden="true"></i><br /><span>分享</span></button>
				</div>
			<div class="col-sm-9 share-button" style="text-align:right;padding-right:20px;border-left:1px solid #ddd;">
				<button class="button" style="width: 100px;background:#DD7165;" @click="callCus(agentTelephone)"><span>联系经纪人</span></button>
			</div>
		</div>
		<!-- 分享 案场热线 推荐客户 -->
		<!--分享图片 -->
		<div class="share-img" v-show="shareImg" @click="shareImg=false"></div>
		<img class="share-img-content" v-show="shareImg" @click="shareImg=false" src="../../assets/images/share.png" width="100%">

    </div>
</template>
<script>
    import slider from './slider.vue'
    import { swiper, swiperSlide } from 'vue-awesome-swiper'
    export default {
        data() {
            return {
                selected: '1',
                flagOpenName: "展开",
                flagCloseName: "收起",
                premises: {},
                flagA:false,
                flagAName: "展开",
                flagB:false,
                flagBName: "展开",
                flagC:false,
                flagCName: "展开",
                flagD:false,
                flagDName: "展开",
                flagE:false,
                flagEName: "展开",
                flagF:false,
                flagFName: "展开",
                flagG:false,
                flagGName: "展开",
                flagH:false,
                flagHName: "展开",
                domain: window.location.href,
                qdltqyShowFlag: true,
                preDynamicList: [],
                premisesImg:'',
                houseType: '',
                someList:[
                ],
                sliderinit: {
                    currentPage: 0,
                    thresholdTime: 500,//滑动时间阈值判定距离
                    thresholdDistance: 100,//滑动距离阈值
                },
                show:false,
                saleStatus:'',
                swiperList:[],
                swiperOption: {
                    initialSlide: 0,
                    speed:100,
                    lazyLoading:true,
                    pagination: '.swiper-pagination',
                    loop: false,
                    navigation: {
                        nextEl: '.next',
                        prevEl: '.prev'
                    }
                },
                width:screen.width,
                height: screen.height - 120,
                swiperShow: false,
                premisesImageType:[{key:'3',title:'样板间'},{key:'4',title:'效果图'},{key:'5',title:'小区配套'},{key:'6',title:'实景图'},{key:'7',title:'项目现场'}],
                premisesImageShow:[],
                premisesImagesSubList:[],
                piShow:false,
                moreShow:false,
                shareImg:false,
                companyUuid:'',
                shareTile:'',
                shareUrl:'',
                shareDesc:'',
                shareName:'',
                showBaseMore: false,
                phoneName:'联系经纪人',
                phoneCan:true,
                premisesDynamic: null
            }
        },
        components: {
            slider,
            swiper,
            swiperSlide
        },
        mounted: function() {
            var _self = this;
            _self.initDomain();
            _self.initPremises();
            _self.initPremisesDynamic();
            _self.initLoading();
            _self.wxConfig();
            // _self.getUserForOpenid();
            $(window).scrollTop(0);
            _self.phoneName = _self.$route.params.phoneName;
            $("#goble_menu_div").hide();
        },
        methods: {
            moreInfo(selected) {
				this.selected = selected; 
			},
            callCus(mobile){
                if(mobile){
                    window.location.href="tel:"+mobile;
                }else{
                    layer.msg("手机号不存在", {
                        time: 2000
                    });
                }
            },
            initDomain(){
                var _self = this;
                var domainIndex = _self.domain.indexOf("qdltqy");
                if(domainIndex >= 0){
                    _self.qdltqyShowFlag = false;
                }
            },
            initLoading(){
                var _self = this;
                window.setTimeout(function () {
                    var numAll = document.getElementsByClassName("rule-textAll").length;
                    for(var i =0 ; i<numAll;i++){
                        var nowHei = document.getElementsByClassName("rule-textAll")[i].offsetHeight;
                        if(nowHei>220){
                            if(i==0){
                                _self.flagA = true;
                            }else if(i==1){
                                _self.flagB = true;
                            }else if(i==2){
                                _self.flagC = true;
                            }else if(i==3){
                                _self.flagD = true;
                            }else if(i==4){
                                _self.flagE = true;
                            }else if(i==5){
                                _self.flagF = true;
                            }else if(i==6){
                                _self.flagG = true;
                            }else if(i==7){
                                _self.flagH = true;
                            }
                        }
                    }

                }, 500);
            },
            openDiv(index){
                this.customHeight(index);
            },
            initPremisesDynamic () {
				var _self = this;
				var body = {};
				body.params = {premisesId:_self.$route.params.id,listFlag: false};
				var url = _self.utilHelper.apiUrl + "/api/getPremisesDynamicList";
				_self.$http.post(url, body).then((response) => {
					if(response.body.responseCode == 1) {
						_self.premisesDynamic = response.body.data[1];
						if(_self.premisesDynamic) {
							let title = _self.premisesDynamic.title;
							if(title.length > 20) {
								_self.premisesDynamic.title = title.substring(0,20)+'...'
							}
							let content = _self.premisesDynamic.content;
							if(content.indexOf('<img') != -1) {
								var imgReg = /<img.*?(?:>|\/>)/gi;
								var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i;
								var arr = content.match(imgReg); 
								_self.premisesDynamic.imgUrl = arr[0].match(srcReg)[1];
								content = content.replace(imgReg,'');
								if(content && content.length > 20) {
									content = content.substring(0, 20) + '...'
								}
								_self.premisesDynamic.content = content
							}
						}
					}
					
				}, (response) => {
					console.log(response);
				});
			},
            initPremises() {
                var _self = this;
                var body = {};
                body.params = {id:_self.$route.params.id};
                var url = _self.utilHelper.apiUrl + "/api/getSharePremisesDetail";
                _self.$http.post(url, body).then((response) => {
                    var data = response.body.resData;
                    _self.premises = data.detailResDto;
                    _self.premisesImg = data.detailResDto.imgUrl;
                    _self.preDynamicList = data.detailResDto.preDynamicList;
                    _self.premisesImages = data.premisesImages;

                    if(Object.keys(_self.premisesImages).length > 0){
                        for(var num  in _self.premisesImageType){
                            if(_self.premisesImages.hasOwnProperty(_self.premisesImageType[num].key)){
                                var column = {};
                                column.key = _self.premisesImageType[num].key;
                                column.title = _self.premisesImageType[num].title;
                                for (var val in _self.premisesImages) {
									if(val == _self.premisesImageType[num].key) {
										column.imgUrl = _self.premisesImages[val][0].imageUrl
									}
								}
                                _self.premisesImageShow.push(column);
                            }
                        }
                    }
                    if(data.detailResDto.saleStatus == 1){
                        _self.saleStatus = "在售";
                    }else if(data.detailResDto.saleStatus == 2){
                        _self.saleStatus = "售罄";
                    }else if(data.detailResDto.saleStatus == 0){
                        _self.saleStatus = "待售";
                    }else{
                        _self.saleStatus = "";
                    }

                    if(_self.premises){
                        var premises = _self.premises;
                        var commission = premises.commission;
                        if(commission){
                            var commissionJson = JSON.parse(commission);
                            var commissionStr = "";
                            for(var jsonStr in commissionJson){
                                commissionStr += commissionJson[jsonStr].name + "" + commissionJson[jsonStr].typeValue + "" + commissionJson[jsonStr].type + "  ";
                            }
                            premises.commission = commissionStr;
                        }
                        //均价
                        if(_self.premises.averagePrice != ','){
                            let price = _self.premises.averagePrice.split(',');
                            if(price.length > 1 ){
                                if(price[0] && price[1]){
                                    _self.premises.averagePrice =price[0] + ' 至 ' + price[1];
                                }else if(price[0]){
                                    _self.premises.averagePrice =price[0];
                                }else if(price[1]){
                                    _self.premises.averagePrice =price[1];
                                }
                            }
                        }
                    }

                    // 数组内push对象
                    data.detailResDto.imgList.forEach(function(item,index){
                        if (item.url) {
                            item.url.split(';').forEach(path => {
                                _self.swiperList.push({"title":item.apartmentLayout,"url": path});
                            })
                        }
                        var objList = {background:'url('+item.url+') no-repeat'}

                        let areaShow = "";
						let areaArr = item.area.split(',')
						if(areaArr.length) areaShow = areaArr[0];
						if(areaArr.length > 1 && areaArr[0] != areaArr[1]) {
							areaShow += " ~ " + areaArr[1]
						}
						item.area = areaShow;

                        _self.someList.push({
                            style:objList,
                            title: item.apartmentLayout,
                            area: areaShow,
                            urls: item.url.split(';')
                        })
                    });

                    //设置图片样式
                    _self.premises.feature = _self.setImg(_self.premises.feature);
                    _self.premises.panoramicView = _self.setImg(_self.premises.panoramicView);
                    _self.premises.discount = _self.setImg(_self.premises.discount);
                    _self.premises.cooperationRule = _self.setImg(_self.premises.cooperationRule);
                    _self.premises.introduction = _self.setImg(_self.premises.introduction);
                    _self.premises.selling = _self.setImg(_self.premises.selling);
                    _self.premises.customer = _self.setImg(_self.premises.customer);
                    _self.premises.saleSkill = _self.setImg(_self.premises.saleSkill);

                    //自定义分享内容
                    var shareId = _self.$route.params.id;
                    var sharePhone = _self.$route.params.telephone;
                    _self.shareName = _self.$route.params.phoneName;
                    _self.shareUrl =window.location.origin + window.location.pathname;
                    if(window.location.search){
                        _self.shareUrl = _self.shareUrl +window.location.search +"#/sharePremisesDetail";
                    }else{
                        _self.shareUrl = _self.shareUrl +"#/sharePremisesDetail";
                    }
                    _self.shareUrl = _self.shareUrl + "/" + shareId; 

                    if (sharePhone){
                        _self.shareUrl = _self.shareUrl+ "/" + sharePhone;
                    }
                    if(_self.shareName){
						_self.shareUrl += '/' +   encodeURI(_self.shareName);
                    }
                    
                    _self.shareTitile =  _self.shareName + _self.premises.name +"|均价" + _self.premises.averagePrice;

                    if(_self.premises.selling){
                        _self.shareDesc = _self.premises.selling.replace(/<\/?.+?>/g,"");
                    }else if(_self.premises.feature){
                        _self.shareDesc = _self.premises.feature.replace(/<\/?.+?>/g,"");;
                    }else{
                        _self.shareDesc = _self.premises.name;
                    }
                    if(!_self.agentTelephone || _self.agentTelephone =='undefined' || _self.agentTelephone == 'null'){
                        _self.phoneCan = false;
                    }
                    _self.initShareContent();
                    _self.agentTelephone = _self.premises.mobile;
                    if(sharePhone && typeof(sharePhone) != 'undefined'){
                        _self.agentTelephone = sharePhone;
                    }
                }, (response) => {
                    console.log(response);
                });
            },
            toRecCustomer() {
                //若为游客则弹出绑定对话框
                if(!this.tourist()){
                    return ;
                }
                this.$router.push({
                    path: '/recommendCustomer/'+this.$route.params.id
                })
            },
            revokeTo:function(msg){
                this.show = msg
            },
            pageFun(index){
                this.swiperShow = true;
                this.swiperSlide.currentPage = index;
                /*if(this.someList.length >0){
                    this.show=true;
                    this.sliderinit.currentPage=index;
                }*/
            },
            toDetail(id){
                this.$router.push({
                    path: '/dynamicDetail/'+id
                })
            },
            goPremisesDynamicList () {
				this.$router.push({
					path: '/premisesDynamic/'+this.$route.params.id
				})
			},
            customHeight(index){
                var _self = this;
                var maxHeight = document.getElementsByClassName("rule-text")[index].offsetHeight;
                if(maxHeight > 220){
                    document.getElementsByClassName("rule-text")[index].style.maxHeight = "220px";
                    if(index==0){
                        _self.flagAName = _self.flagOpenName;
                    }else if(index==1){
                        _self.flagBName = _self.flagOpenName;
                    }else if(index==2){
                        _self.flagCName = _self.flagOpenName;
                    }else if(index==3){
                        _self.flagDName = _self.flagOpenName;
                    }else if(index==4){
                        _self.flagEName = _self.flagOpenName;
                    }else if(index==5){
                        _self.flagFName = _self.flagOpenName;
                    }else if(index==6){
                        _self.flagGName = _self.flagOpenName;
                    }else if(index==7){
                        _self.flagHName = _self.flagOpenName;
                    }
                }else{
                    if(document.getElementsByTagName('pre')[index]) {
                        document.getElementsByTagName('pre')[index].setAttribute('style','white-space: pre-wrap;word-break: break-word;');
                    }
                    document.getElementsByClassName("rule-text")[index].style.maxHeight = document.getElementsByClassName("rule-textAll")[index].offsetHeight+"px";
                    if(index==0){
                        _self.flagAName = _self.flagCloseName;
                    }else if(index==1){
                        _self.flagBName = _self.flagCloseName;
                    }else if(index==2){
                        _self.flagCName = _self.flagCloseName;
                    }else if(index==3){
                        _self.flagDName = _self.flagCloseName;
                    }else if(index==4){
                        _self.flagEName = _self.flagCloseName;
                    }else if(index==5){
                        _self.flagFName = _self.flagCloseName;
                    }else if(index==6){
                        _self.flagGName = _self.flagCloseName;
                    }else if(index==7){
                        _self.flagHName = _self.flagCloseName;
                    }
                }

//	        	if(index == 0){
//					this.falgA = false;
//				}else if(index == 1){
//					this.falgB = false;
//				}else{
//					this.falgC = false;
//				}

            },
            toRecommendUser(){
                //若为游客则弹出绑定对话框
                if(!this.tourist()){
                    return ;
                }
                var _self = this;
                var id = _self.$route.params.id;
                this.$router.push({
                    path: '/myDeclare/'+id
                })
            },
            setImg(imgText){
                if(!imgText){
                    return '';
                }
                var text = imgText.split("<img");
                if(text.length <= 1){
                    return imgText;
                }

                var tempText = '';
                text.forEach(function(item,index){
                    if(index == 0){
                        tempText += item;
                    }else{
                        tempText += '<img width=100%'+item;
                    }

                });

                return tempText;


            },
            // 楼盘相册
            premisesImageClick(key){
                var _self = this;
                if(_self.premisesImages){
                    _self.premisesImagesSubList = _self.premisesImages[key];
                }
                _self.piShow = true;
                this.$forceUpdate();
            },
            showImgCount(list){
                if(list){
                    return list.length;
                }else{
                    return 0;
                }
            },
            //自定义分享内容
            //注册jssdk
            wxConfig(){
                //微信配置
                var currUrl=location.href.split('#')[0];
                var body = {};
                body.params={
                    url:currUrl
                };
                var url = this.utilHelper.apiUrl+'/api/js_ticket';
                this.$http.post(url,body).then((response)=>{
                    var data = response.body.resData;
                    wx.config({
                        debug: false,
                        appId: data.appid, // 必填，公众号的唯一标识
                        timestamp: data.time, // 必填，生成签名的时间戳
                        nonceStr: data.noncestr, // 必填，生成签名的随机串
                        signature: data.signature,// 必填，签名，见附录1
                        jsApiList: ['updateAppMessageShareData','updateTimelineShareData','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareQZone']
                    });
                    if(data.appid && data.companyUuid){
                        // this.getUserForOpenid(data.appid,data.companyUuid);
                    }
                    this.companyUuid = data.companyUuid;
                });

            },
            initShareContent() {
                var _self = this;

                //分享到qq  微信好友
                wx.ready(function () {      //需在用户可能点击分享按钮前就先调用
                    //分享好友
                    wx.updateAppMessageShareData({
                        title: _self.shareTitile, // 分享标题
                        desc: _self.shareDesc,// 描述
                        link: _self.shareUrl.split('#')[0] +'#' +_self.shareUrl.split('#')[1] , // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                        imgUrl: _self.premises.url, // 分享图标
                        success: function () {
                            // 设置成功
                            // alert("分享好友配置好了")
                        }
                    });
                    //分享朋友圈，qq空间
                    wx.updateTimelineShareData({
                        title: _self.shareTitile, // 分享标题
                        link: _self.shareUrl.split('#')[0] +'#' +_self.shareUrl.split('#')[1], // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                        imgUrl: _self.premises.url, // 分享图标
                        success: function () {
                            // 设置成功
                            // alert("分享朋友圈");
                        }
                    });
                    //旧接口 朋友圈
                    wx.onMenuShareTimeline({
                        title: _self.shareTitile, // 分享标题
                        link: _self.shareUrl.split('#')[0] +'#' +_self.shareUrl.split('#')[1], // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                        imgUrl: _self.premises.url, // 分享图标
                        success: function () {
                            // 用户点击了分享后执行的回调函数
                        },
                    });
                    // 旧接口 分享给好友
                    wx.onMenuShareAppMessage({
                        title: _self.shareTitile, // 分享标题
                        desc: _self.shareDesc, // 分享描述
                        link: _self.shareUrl.split('#')[0] +'#' +_self.shareUrl.split('#')[1], // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                        imgUrl: _self.premises.url, // 分享图标
                        type: 'link', // 分享类型,music、video或link，不填默认为link
                        dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                        success: function () {

                        }
                    });
                    //旧接口 分享给qq好友
                    wx.onMenuShareQQ({
                        title: _self.shareTitile, // 分享标题
                        desc: _self.shareDesc, // 分享描述
                        link: _self.shareUrl.split('#')[0] +'#' +_self.shareUrl.split('#')[1], // 分享链接
                        imgUrl: _self.premises.url, // 分享图标
                        success: function () {
                        },
                        cancel: function () {
                        }
                    });
                    //旧接口 分享到QQ空间
                    wx.onMenuShareQZone({
                        title: '', // 分享标题
                        desc: '', // 分享描述
                        link: '', // 分享链接
                        imgUrl: '', // 分享图标
                        success: function () {
                        },
                        cancel: function () {
                        }
                    });
                });
            },

            //调用授权页面
            gotoWeiXinAuth(appId,companyUuid){
                var state = companyUuid + "|" + window.location.hostname + "|" + encodeURIComponent(window.location.pathname)  + "|sharePremisesDetail|" + this.$route.params.id+"|"+this.agentTelephone;

                var weixinUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURIComponent(this.utilHelper.apiUrl+"/weixin/getWeiXinAuth")+"&response_type=code&scope=snsapi_userinfo&state="+state+"&connect_redirect=1#wechat_redirect";
                window.location.href=weixinUrl;
            },
            //获取用户信息
            getUserForOpenid(appId,companyUuid){
                var _self = this;
                var url = _self.utilHelper.apiUrl + "/weixin/getUserForOpenId?openid="+_self.$route.params.openid;
                if(!_self.$route.params.openid){
                    _self.gotoWeiXinAuth(appId,companyUuid);
                    return;
                }else if(_self._self.$route.params.openid = '-1'){
                    return;
                }

                _self.$http.post(url,null ).then((response) => {
                    var body = response.body;
                    if(body.responseCode==1){
                        _self.nickname = body.nickname;
                    }else{
                        _self.gotoWeiXinAuth(appId,companyUuid);
                    }

                }, (response) => {
                    console.log(response);
                });
            },
            //查看更多
            readMore(){
                var _self = this;
                _self.moreShow=true;
                _self.initLoading();
            },
            readBaseMore () {
                this.showBaseMore = true;
            }

        }
    }
</script>
<style scoped>
    .item-title-half{background-color: #fff;padding: 0 10px;}
	.item-title-half li{border-bottom: 1px solid #cdcdcd;position: relative;line-height: 42px;height: 42px;}
	.item-title-half li:last-child{border-bottom-style: none;}
	.item-title-half .title{position: absolute;left: 0;top: 0px;width: 80px;overflow: hidden;}
	.item-title-half .itemText{text-align: right;width: 100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
	.swiper-box {width: 100%;height: 100%;margin: 0 auto;position: fixed;top:0;z-index:60;}
	.swiper-item {height: 100%;text-align: center;font-size: 18px ;background: #000;display: -webkit-box;display: -ms-flexbox;display: -webkit-flex;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;-webkit-justify-content: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;-webkit-align-items: center;align-items: center;position: relative}
	.next,.prev{position: absolute;top: 50%;width: 50px;height: 45px;margin-top: -22px;z-index: 10;cursor: pointer;background-size: 50px 45px;background-position: center;background-repeat: no-repeat;}
	.next{background-image:url("../../assets/images/next.png");right:10px;left:auto;}
	.prev{background-image:url("../../assets/images/prev.png");left:10px;right:auto;}
	.swiper-closed {position: fixed;bottom: 50px;left: 0px;right: 0px;width: 50px;height: 50px;margin-left:auto;margin-right:auto;font-size: 50px;color:#fe5419;border-radius: 50%;line-height: 45px;text-align: center;z-index: 101;}
	.swiper-title{position: absolute;top: 10px;left: 0px;right: 0px;width: 250px;height: 50px;margin-left:auto;margin-right:auto;font-size: 18px;color:#ffffff;}
	.rule-text{overflow: hidden;max-height: 220px;}
	.rule-textAll{text-indent:0;padding-right:10px}
	.rule-textAll p img{width:100%}
	.tel-image { width:30px; height:30px; }
	.premises-details{padding:10px 10px;background:#FFF;}
	.premises-img{position: relative;width: 100%;height: 200px;overflow: hidden;text-align: center;}
	.premises-img img{width: 100%;}
	.codeNameContainer {margin: 10px 0 0 0;}
	.codeNameContainer .codeNameItem {margin: 0 10px 10px 0;padding: 3px 10px;background-color: #E4E4E4;color: #666666;display: inline-block;border-radius: 3px;}
	.premises-mask-info{height: 40px;line-height: 40px;color: #000;width:100%;font-size: 16px;font-weight: 600;border-bottom: 1px solid #D7D7D7;}
	.premises-mask-info .name{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;text-align: left}
	.premises-mask-info .square{text-align: right;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
	.premise-address{line-height: 25px;color:#999;width: 100%;}
	.premise-address .text{color: #000;}
	.premises-color{color:#F07B67;font-weight: 400;font-size: 16px;}
	.premises-img .sale{    position: absolute;right: 0;top: 0;background-color: #02be9d;color: #fff;width: 44px;height: 20px;text-align: center;line-height: 20px;}
	.share{background: #FFF;width:100%;height: 50px;vertical-align: middle; position: fixed;bottom: 0;left: 0;z-index: 9;border-top:1px solid #ccc;}
	.share-button{color:#FFF;margin: 8px 0;text-align: center}
	.share-button span{margin: 0 5px;}
    .premises-details .panorama360{ position: absolute;z-index: 10;width: 100px;transform: translate(-50%,-50%);top: 50%;left: 50%;}
	.share-left{margin-top: 5px; text-align: center;}
	.share-a{background:#FFF;color:#000;width: 40px;height: 40px;text-align: center; word-wrap: break-word}
	.share-img{width: 100%;height: 100%;position: fixed;left: 0;top:0;z-index: 1000;background-color: #000;opacity: 0.8; }
	.share-img-content{width: 300px;position: fixed;right: 20px;top:20px;z-index:1001}
	.container{padding-bottom:110px;}
	.mint-navbar {background-color: #fff;text-align: center;}
	.mint-navbar .mint-tab-item {padding: 10px 0;font-size: 15px;color: #999999;}
	.mint-navbar .mint-tab-item.is-selected {color: #fff;margin-bottom: auto;background-color: #ff962e;border-bottom-style: none;}
	.exhibition-title2{position: relative;padding-left: 26px;height: 50px;line-height: 50px;margin-bottom: -10px}
	.exhibition-title2 .title-logo2{width: 20px;height: 20px;position: absolute;left: 0;top: 12px; display: inline-block;background: url(../../assets/images/iconImages.png) no-repeat;background-size: 100px auto;background-position: 0 0;}
	.logo-pos02 .title-logo2{background-position: -20px 0;}
	.sellHouseImg {width: 150px;height: 120px;float: left;}
	.sellHouseInfo {float: left;padding: 5px 0 0 20px;font-size: 14px;line-height: 25px;}
	.premisesInfo{margin-bottom: 10px;background-color: #FFF;padding: 0 10px;}
	.premisesInfo .title {height: 40px; line-height: 40px;}
	.premisesInfo .title .left{color: #000;font-size: 15px;font-weight: bold;}
	.premisesInfo .title .right{color: #999999;font-size: 13px;font-weight: bold;float: right;}
	.premisesInfo .sellImg {text-align: center;padding: 5px 0;}
	.premisesInfo .sellImg img {width: 70vw;height: 60vw;}
	.premisesInfo .bottomInfo {border-top: 1px solid #F2F2F2;color: #FF9933;height: 36px;line-height: 36px;text-align: right;font-size: 14px;}
	.premisesAlbum {padding: 20px 20px 0 20px;border-bottom: 1px solid #ccc;text-align: center;background-color: #FFF;}
	.premisesAlbum img {width: 100%;height: 60vw;}
	.premisesAlbum .text {font-size: 15px;color: #000;line-height: 40px;}
	.dynamicInfo {padding-bottom: 10px;}
	.dynamicInfo h1{font-size: 14px;line-height: 30px;}
	.dynamicInfo img {width: 100%;height: 130px;padding-bottom: 10px;}
    .hxtImgTip {position: absolute;top: 116px;left: 135px;background-color: #ddd;width: 25px;height: 18px;text-align: center;line-height: 18px;}
</style>